package com.wyw.design.model.learning.behavioral.strategy;

import java.util.ArrayList;
import java.util.List;

/**
 * @Title
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * @Date 2023/4/19 16:41
 * Update History:
 * Author        Time            Content
 */
public class StrategyClient {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>(3);
        list.add("admin");
        list.add("code-shop");
        list.add("lucy");

        StringSortContext context = new StringSortContext(new StringSortStrategyReverse());
        List<String> reverseSortedList = context.getSortList(list);
        System.out.println(reverseSortedList); // [lucy, code-shop, admin]

        StringSortContext context2 = new StringSortContext(new StringSortStrategyNormal());
        List<String> normalSortedList = context2.getSortList(list);
        System.out.println(normalSortedList); // [admin, code-shop, lucy]
    }
}
